import java.io.*;
import java.net.*;

public class ftpbytcps
{
        public static void main(String arg[])throws IOException
        {
                try{
		ServerSocket serversock=new ServerSocket(7070);
		Socket sock=serversock.accept();
                BufferedReader br;
                OutputStream out;
                InputStream in;
                out=sock.getOutputStream();
                in=sock.getInputStream();
		br=new BufferedReader(new InputStreamReader(in));
		PrintStream ps=new PrintStream(out);
		String recvcomm=br.readLine();
		Process p=Runtime.getRuntime().exec(recvcomm);
		BufferedReader prin=new BufferedReader(new InputStreamReader(p.getInputStream()));
		String line="";

		while((line=prin.readLine())!=null)
			System.out.println(line);
		ps.println("we executed the command"+recvcomm);
		
                }
                catch(Exception e)
                {
                        System.out.println(""+e);
                }
        }
}

